package ioc16;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

public class SomeBean implements InitializingBean, BeanNameAware, BeanFactoryAware, ApplicationContextAware {

    private String str;

    public SomeBean() {
        System.out.println("SomeBean.SomeBean()");
    }

    public String getStr() {
        return str;
    }

    public void setStr(String str) {
        System.out.println("SomeBean.setStr()");
        this.str = str;
    }

    @Override
    public void setBeanName(String s) {
        System.out.println("SomeBean.setBeanName()");
    }


    @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
        System.out.println("SomeBean.setBeanFactory()");
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        System.out.println("SomeBean.setApplicationContext()");
    }



    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("SomeBean.afterPropertiesSet()");
    }

    public void init(){
        System.out.println("SomeBean.init()");
    }

    public void destroy(){
        System.out.println("SomeBean.destroy()");
    }
}
